import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const useUserStore = defineStore('big-user', () => {
  const token = ref('')
  const setToken = (newToken) => {
    console.log("store设置token")
    token.value = newToken
  }
  const removeToken = () => {
    token.value = ''
  }
  const user = ref({})
  // const getUser = async () => {
  //   const res = await userGetInfoService() // 请求获取数据
  //   user.value = res.data.data
  // }
  const setUser = (obj) => {
    console.log("store设置user")
    console.log(obj)
    user.value = obj
  }
  return { 
    token,
    user,
    setToken,
    removeToken,
    // getUser,
    setUser

  }
}
,{
  persist: true,
}
)
